const Doctor = require('../models/doctor_model')
const jsonResult = require('../utils/JSON')

// 医生-获取医生列表
exports.doctorListGet = async (ctx,next) => {
    try {
        let { body } = ctx.request.body;
        let res = await Doctor.doctorListGet(body);
        console.log(res,"departmentListGet");
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res)
    } catch (error) {
        console.log(error)
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}

// 医生-医生添加
exports.doctorAdd = async (ctx)=>{
    try{
        let { body } = ctx.request.body;
        let res = await Doctor.doctorAdd(body);
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res)
    }catch(error){
        console.log(error);
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}
// 医生-医生信息修改
exports.doctorUpdate = async (ctx)=>{
    try{
        let { body } = ctx.request.body;
        let res = await Doctor.doctorUpdate(body);
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res); 
    }catch(error){
        console.log(error);
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}
// 医生-删除医生
exports.doctorDelete = async (ctx)=>{
    try{
        let { body } = ctx.request.body;
        let res = await Doctor.doctorDelete(body);
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res);
    }catch(error){
        console.log(error);
    }
}